package com.tiancheng.trade.settlement.controller.admin;


import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.settlement.exception.BusinessException;
import com.tiancheng.trade.settlement.exception.error.ArgumentErrorInfoEnum;
import com.tiancheng.trade.settlement.service.settlement.IComparisonFlowService;
import com.tiancheng.trade.settlement.vo.settlement.admin.ComparisonFlowVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/flow/comparison")
@Slf4j
public class ComparisonFlowController {
    @Autowired
    private IComparisonFlowService comparisonFlowService;

    @GetMapping("/query")
    public Result findById(String date) throws BusinessException {
        Assert.isTrue(date != null, ArgumentErrorInfoEnum.VALID_ERROR.getMessage());
        return Result.success(comparisonFlowService.queryComparisonInfo(date));
    }


    @PostMapping("/batchRemarkSubOrder")
    public Result batchRemarkSubOrder(@RequestBody ComparisonFlowVO vo) throws BusinessException {
        Assert.isTrue(vo.getDate() != null, ArgumentErrorInfoEnum.VALID_ERROR.getMessage());
        Assert.isTrue(vo.getRemark() != null, ArgumentErrorInfoEnum.VALID_ERROR.getMessage());
        return comparisonFlowService.proccess(vo);
    }

}
